import request from '@/utils/request'

// 查询科普知识列表
export function listScience(query) {
  return request({
    url: '/system/science/list',
    method: 'get',
    params: query
  })
}

// 查询科普知识详细
export function getScience(id) {
  return request({
    url: '/system/science/' + id,
    method: 'get'
  })
}

// 新增科普知识
export function addScience(data) {
  return request({
    url: '/system/science',
    method: 'post',
    data: data
  })
}

// 修改科普知识
export function updateScience(data) {
  return request({
    url: '/system/science',
    method: 'put',
    data: data
  })
}

// 删除科普知识
export function delScience(id) {
  return request({
    url: '/system/science/' + id,
    method: 'delete'
  })
}

/**
 * 上传文件
 * @param val
 * @returns {*}
 */
export function uploadFile(val) {
  return request({
    url: '/common/upload',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: val
  })
}
